package com.domain.utils;

import org.apache.commons.lang3.StringUtils;

import java.util.*;

/**
 * 非空判断类
 */
public class NotNullUtils {
    /**
     * 判断对象是否为空（list，对象，字符串）
     * @return  true：不为空，false：空
     */
    public static Boolean isNotNullObject(Object object) {
        if (object == null) {
            return false;
        }
        /*if (object == "") {
            return false;
        }*/
        if (object instanceof String && StringUtils.isBlank(object.toString())) {
            return false;
        }
        if (object instanceof List || object instanceof ArrayList || object instanceof LinkedList) {
            List list = (List) object;
            if (list.size()<=0) {
                return false;
            }
        }
        if (object instanceof Set || object instanceof HashSet || object instanceof TreeSet) {
            Set set = (Set) object;
            if (set.size() <= 0) {
                return false;
            }
        }
        return true;
    }
}
